//
//  NMPOIPResultInfoCell.swift
//  NMPO
//
//  Created by PowerfullClean on 2023/10/31.
//

import UIKit

class NMPOIPResultInfoCell: NMPOScanResultInfoCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        nmpo_iconView3.addSubview(nmpo_loctionview)
        nmpo_iconView3.addSubview(nmpo_cityView)
        nmpo_iconView3.addSubview(nmpo_regionView)
        nmpo_iconView3.addSubview(nmpo_countryView)
        nmpo_iconView2.image = UIImage(named: "nmpo_result_testIp")
        nmpo_loctionview.snp.makeConstraints { make in
            make.width.equalTo(nmpo_w/2.0)
            make.left.equalToSuperview().offset(56)
            make.top.equalToSuperview()
            make.height.equalTo(66)
        }
        nmpo_cityView.snp.makeConstraints { make in
            make.width.equalTo(nmpo_w/2.0)
            make.right.equalToSuperview()
            make.top.equalToSuperview()
            make.height.equalTo(66)
        }
        nmpo_regionView.snp.makeConstraints { make in
            make.width.equalTo(nmpo_w/2.0)
            make.left.equalToSuperview().offset(56)
            make.bottom.equalToSuperview()
            make.height.equalTo(66)
        }
        nmpo_countryView.snp.makeConstraints { make in
            make.width.equalTo(nmpo_w/2.0)
            make.right.equalToSuperview()
            make.bottom.equalToSuperview()
            make.height.equalTo(66)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    var nmpo_ipScanModel: NMPOIPScanModel? {
        didSet {
            guard let nmpo_ipScanModel = nmpo_ipScanModel else { return }
            nmpo_loctionview.nmpo_valueLabel.text = nmpo_ipScanModel.nmpo_loction
            nmpo_cityView.nmpo_valueLabel.text = nmpo_ipScanModel.nmpo_city
            nmpo_regionView.nmpo_valueLabel.text = nmpo_ipScanModel.nmpo_region
            nmpo_countryView.nmpo_valueLabel.text = nmpo_ipScanModel.nmpo_country
        }
    }
    
    lazy var nmpo_loctionview: NMPOTestResultInfoItemView = {
        let nmpo_loctionview = NMPOTestResultInfoItemView()
        nmpo_loctionview.nmpo_titleLabel.text = "Location"
        nmpo_loctionview.nmpo_valueLabel.text = "0"
        return nmpo_loctionview
    }()
    lazy var nmpo_cityView: NMPOTestResultInfoItemView = {
        let nmpo_cityView = NMPOTestResultInfoItemView()
        nmpo_cityView.nmpo_titleLabel.text = "City"
        nmpo_cityView.nmpo_valueLabel.text = "0"
        return nmpo_cityView
    }()
    lazy var nmpo_regionView: NMPOTestResultInfoItemView = {
        let nmpo_regionView = NMPOTestResultInfoItemView()
        nmpo_regionView.nmpo_titleLabel.text = "Region"
        nmpo_regionView.nmpo_valueLabel.text = "0"
        return nmpo_regionView
    }()
    lazy var nmpo_countryView: NMPOTestResultInfoItemView = {
        let nmpo_countryView = NMPOTestResultInfoItemView()
        nmpo_countryView.nmpo_titleLabel.text = "Country"
        nmpo_countryView.nmpo_valueLabel.text = "0"
        return nmpo_countryView
    }()
}
